home *** CD-ROM | disk | FTP | other *** search
/ The Atari Compendium / The Atari Compendium (Toad Computers) (1994).iso / files / prgtools / mint / mntdoc01.zoo / mintdoc / cat3 / getlogin.3 < prev    next >
Encoding:
Text File  |  1993-03-03  |  1.5 KB  |  67 lines

  1.  
  2.  
  3.  
  4. GETLOGIN(3)         MINTLIB LIBRARY FUNCTIONS         GETLOGIN(3)
  5.  
  6.  
  7. N✓NA✓AM✓ME✓E
  8.        getlogin - get login name
  9.  
  10. S✓SY✓YN✓NO✓OP✓PS✓SI✓IS✓S
  11.        #include <unistd.h>
  12.  
  13.        char *getlogin(void);
  14.  
  15. D✓DE✓ES✓SC✓CR✓RI✓IP✓PT✓TI✓IO✓ON✓N
  16.        getlogin returns a pointer to the user's login name.  This
  17.        is determined in the following way:
  18.          - The name for the current userid is read from the
  19.            password file using getuid and getpwuid.
  20.          - If this fails, the environment variable USER is  read.
  21.          - If this fails, "user" is returned.
  22.  
  23.        This  call  returns  a  pointer to a dynamically allocated
  24.        area of memory. Consecutive calls  will  return  the  same
  25.        pointer.
  26.  
  27. S✓SE✓EE✓E A✓AL✓LS✓SO✓O
  28.        c✓cu✓us✓se✓er✓ri✓id✓d(✓(3✓3)✓),✓,    g✓ge✓et✓tg✓gr✓re✓en✓nt✓t(✓(3✓3)✓),✓,    g✓ge✓et✓tp✓pw✓we✓en✓nt✓t(✓(3✓3)✓),✓,   g✓ge✓et✓tp✓pw✓wu✓ui✓id✓d(✓(3✓3)✓),✓,
  29.        g✓ge✓et✓tu✓ui✓id✓d(✓(3✓3)✓)
  30.  
  31. N✓NO✓OT✓TE✓ES✓S
  32.        The method used to determine the user's login name,  getp-
  33.        wuid(getuid()),  is  supposed to be the most reliable way.
  34.        It will fail if several  users  have  identical  numerical
  35.        userids, though.
  36.  
  37.        On  System  V,  this  routine  will read from /etc/utmp in
  38.        order to find out the  current  user's  login  name.  This
  39.        method  can  be fooled by changing the terminal associated
  40.        with standard input, and thus is no viable alternative.
  41.  
  42.  
  43.  
  44.  
  45.  
  46.  
  47.  
  48.  
  49.  
  50.  
  51.  
  52.  
  53.  
  54.  
  55.  
  56.  
  57.  
  58.  
  59.  
  60.  
  61.  
  62.  
  63.  
  64. MiNT docs 0.1              3 March 1993                         1
  65.  
  66.  
  67.